#include <iostream>

using namespace std;

int main(int argc, char * argv[])
{
	const int maxN = 100;
	int arr[maxN * maxN + 1];
	int temp[maxN + 1];

	int N;
	cin >> N;

	for (int i = 0; i < N * N; i++) {
		cin>>arr[i];
	}

	int max = -1;
	for (int i = 0; i < N; i++) {
		for (int j = i; j < N; j++) {
			for (int k = 0; k < N; k++) {
				temp[k] = 0;
				for (int l = i; l <= j; l++) {
					temp[k] += arr[k * N + l];
				}
			}

			int alter = temp[0];
			for (int k = 1; k < N; k++) {
				if (alter <= 0) {
					alter = temp[k];
				} else {
					alter += temp[k];		
				}

				if (alter > max)
					max = alter;
			}
		}
	}
	cout<<max<<endl;



	return 0;
}